package com.sgb.contract.view.ui.fragment;

import com.sgb.contract.api.AbstractCallBack;
import com.sgb.contract.api.ContractNet;
import com.sgb.contract.base.ContractSdk;
import com.sgb.contract.base.viewmodel.BaseViewModel;
import com.sgb.contract.model.UpdateBean;
import com.swgk.core.base.model.entity.BaseEntity;
import com.swgk.core.dialog.DialogHelper;

import java.util.List;

import androidx.lifecycle.MutableLiveData;

/**
 * 作者:张磊
 * 日期:2021/12/2 0002
 * 说明:修改记录
 */
public class UpdateViewModel extends BaseViewModel {

    public MutableLiveData<List<UpdateBean>> mDatas = new MutableLiveData<>();


    /**
     * 根据合同编号获取合同修改日志
     */
    public void findByContractNo(String contractNo) {
        DialogHelper.showProgressDialog(ContractSdk.getInstance().getTopActivity(), "数据加载中").setCanceledOnTouchOutside(false);
        ContractNet.getInstance().getContractApi().findByContractNo(contractNo).enqueue(new AbstractCallBack<BaseEntity<List<UpdateBean>>>() {
            @Override
            public void onSuccess(BaseEntity<List<UpdateBean>> data) {
                mDatas.setValue(data.getData());
            }

            @Override
            public void onFinally() {
                DialogHelper.dismissProgressDialog();
                super.onFinally();
            }
        });
    }
} 